<!doctype html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>用户管理</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">

<div class="container py-5">
    <h2 class="text-center text-primary mb-4">👥 用户管理</h2>
    
    <table class="table table-bordered table-hover bg-white shadow-sm">
        <thead class="table-primary">
            <tr>
                <th>ID</th>
                <th>用户名</th>
                <th>角色</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for user in users %}
            <tr>
                <td>{{ user[0] }}</td>
                <td>{{ user[1] }}</td>
                <td>{{ user[2] }}</td>
                <td>
                    {% if user[2] != 'admin' %}
                    <a href="{{ url_for('delete_user', user_id=user[0]) }}" class="btn btn-sm btn-danger"
                       onclick="return confirm('确定要删除该用户吗？');">删除</a>
                    {% else %}
                    <span class="text-muted">不可删除</span>
                    {% endif %}
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>

    <div class="text-center mt-4">
        <a href="{{ url_for('admin_home') }}" class="btn btn-outline-secondary">返回后台首页</a>
    </div>
</div>

</body>
</html>
